package loteria.utils;

import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Properties;

public class Propiedades {
	
	
	public static String getValue(String key) {
		Properties props = new Properties();
		String value = null;
		try {
			String filenameOnClasspath = "/loterias.properties"; 
			URL url = new Propiedades().getClass().getResource(filenameOnClasspath);
			String fullyQualifiedFilename = url.getFile();
			props.load(new FileInputStream(fullyQualifiedFilename));
			

			if (props.getProperty(key) != null) {
				value = props.getProperty(key);
			}
			
			return value;
		}


		catch (IOException e) {
			System.out.println("Error al conseguir properties:"+e.toString());
		}

		return null;
	}
}
